import book.BookList;
import user.AdminUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

public class Main {
  public static User login(){
      System.out.println("欢迎登入图书管理系统！");
      System.out.println("请输入您的姓名：");
      Scanner sc=new Scanner(System.in);
      String name= sc.nextLine();
      while(true){
          System.out.println("请输入你的身份：");
          System.out.println("1.管理员  2.学生");
          int choice = sc.nextInt();
          if (choice==1){
              AdminUser adminUser=new AdminUser(name);
              return adminUser;
          }else if(choice==2){
              NormalUser normalUser=new NormalUser(name);
              return normalUser;
          }else{
              System.out.println("系统错误！");
              System.out.println("请重新选择！");
          }

      }
  }

    public static void main(String[] args) {
        BookList bookList=new BookList();
        User user=login();
        while(true){
            int choice= user.menu();
            user.doIoperations(choice,bookList);
        }
    }
}
